using System;
using System.Collections.Generic;
using System.Text;

namespace DBSourceToolsLib
{
    class DirHelper
    {
        public void DeleteFilesInDir(string strDir)
        {
            if (System.IO.Directory.Exists(strDir))
            {
                System.IO.DirectoryInfo baseDirInfo = new System.IO.DirectoryInfo(strDir);
                foreach (System.IO.DirectoryInfo oDir in baseDirInfo.GetDirectories())
                {
                    System.IO.FileAttributes oAttrib = (System.IO.FileAttributes)oDir.Attributes;
                    if (!oAttrib.ToString().Contains("Hidden"))
                    {
                        DeleteFilesInDir(strDir + "\\" + oDir.Name);
                    }
                        //oDir.Delete(true);
                }
                foreach (System.IO.FileInfo oFile in baseDirInfo.GetFiles())
                {
                    FileUtils.EnsureFileIsWriteable(oFile.FullName);
                    System.IO.File.Delete(oFile.FullName);
                }
            }

        }
    }
}
